<?php require_once('Connections/MYCONN.php'); ?>
<?php
global $totals;
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_MYCONN, $MYCONN);
$query_ActSummary = "select  l.Name, a.Value*l.NameValue*l.Direction Amount from tb_activity a, tb_lookups l where a.LookupID=l.ID";
$ActSummary = mysql_query($query_ActSummary, $MYCONN) or die(mysql_error());
$row_ActSummary = mysql_fetch_assoc($ActSummary);
$totalRows_ActSummary = mysql_num_rows($ActSummary);


?>
<style type="text/css">
<!--
.style1 {
	font-size: medium;
	font-weight: bold;
}
-->
</style>

<table class="TAB-BOX-COINS" title="Activity Summary">
<tr><td colspan="2" class="Column-header">Activity Summary</td></tr>
<tr><td colspan="2" bgcolor="#333333" height="3px"></td>
</tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_ActSummary['Name']; ?></td>
      <td align="right"><?php echo $row_ActSummary['Amount']; ?></td>
    </tr>
	<?php $totals=$totals+ $row_ActSummary['Amount'];?>
        <?php } while ($row_ActSummary = mysql_fetch_assoc($ActSummary)); ?>
<tr><td colspan="2" bgcolor="#333333" height="3px"></td>		
    <tr>
      <td><span class="style1">Totals : </span></td>
      <td align="right"><span class="style1"><?php echo $totals; ?></span></td>
    </tr>
</table>
		<?php mysql_free_result($ActSummary);?>